<?php
    $xtpl_show      = new XTemplate("view/member/show.htm");
    
    $id = $_GET['id'];
    
    $sql    = "SELECT * FROM member WHERE id_m='" . $id . "'";
    $result = mysql_query($sql);
    $row    = mysql_fetch_array($result);
    
    $sql_date   = "SELECT   DAY(birthday), MONTH(birthday), YEAR(birthday), 
                            DAY(register_date), MONTH(register_date), YEAR(register_date) 
                   FROM     member
                   WHERE    id_m='" . $id . "'";
    $re_date    = mysql_query($sql_date);
    $row_date   = mysql_fetch_row($re_date);
    
    if(($row_date[0] == '00')&&($row_date[1] == '00')&&($row_date[2] == '0000')){
        $birthday   = "Không có";
    }
    else{
        $birthday   = $row_date[0] . "-" . $row_date[1] . "-" . $row_date[2];
    }
    if($row['gender'] == NULL){
        $gender = "Không xác định";
    }
    else{
        $gender = $row['gender'];
    }
    if($row['address'] == NULL){
        $address = "Không có";
    }
    else{
        $address = $row['address'];
    }
    if($row['phone'] == NULL){
        $phone = "Không có";
    }
    else{
        $phone = $row['phone'];
    }
    if($row['email'] == NULL){
        $email = "Không có";
    }
    else{
        $email = $row['email'];
    }
    
    $xtpl_show  -> assign('username', $row['username']);
    $xtpl_show  -> assign('fullname', $row['fullname']);
    $xtpl_show  -> assign('birthday', $birthday);
    $xtpl_show  -> assign('gender', $gender);
    $xtpl_show  -> assign('address', $address);
    $xtpl_show  -> assign('phone', $phone);
    $xtpl_show  -> assign('email', $email);
    $xtpl_show  -> assign('register_day', $row_date[3]);
    $xtpl_show  -> assign('register_month', $row_date[4]);
    $xtpl_show  -> assign('register_year', $row_date[5]);
    
    $xtpl_show      -> parse("SHOW");
    $content        = $xtpl_show -> text("SHOW");
?>